<template>
<view class="group">
    <block v-for="(item, index) in goods" :key="index">
        <!-- <navigator hover-class='none' url='/pages/goods/goods-detail/index?id={{item.id}}'> -->
            <view class="item" :data-id="item.id" @tap="goDetail">
                <view class="img_box">
                    <image lazy-load lazy-load-margin="0.5" :src="item.picUrls[0] || '../../public/img/no_pic.png'"></image>
                    <image class="lable" mode="widthFix" :src="labelImg"></image>
                </view>
                <view class="name padding-top-sm ellipsisN">{{item.name}}</view>
                <view class="price margin-top-sm" :data-id="item.id" @tap.stop="addShopCart">
                    <view>
                        <view class="margin-left-xs">
                            <text class="price1 font20">￥</text>
                            <text class="price2">{{item.discountSalePrice}}</text>
                            <text class="price3">￥{{item.priceDown}}</text>
                        </view>
                        <view class="margin-right-sm">立即抢购</view>
                    </view>
                    <image src="/static/grid/images/55.png"></image>
                </view>
            </view>
        <!-- </navigator> -->
    </block>
</view>
</template>

<script>

export default {
  data() {
    return {};
  },

  components: {},
  props: {
    goods: {
      type: Array
    },
    labelImg: {
      type: String,
      default: ''
    } // disDiscountId: {
    //   type: String
    // },
    // //折扣类型
    // disType: {
    //   type: String,
    //   value: ''
    // },
    // //满足条件
    // disCondition: {
    //   type: String,
    //   value: ''
    // },
    // //优惠金额
    // disReduce: {
    //   type: String,
    //   value: ''
    // },
    // //优惠折扣
    // disDiscount:{
    //   type: String,
    //   value: ''
    // }

  },
  methods: {
    goDetail(e) {
      let {
        id
      } = e.currentTarget.dataset;
      uni.navigateTo({
        url: `/pages/goods/goods-detail/index?id=${id}`
      });
    },

    addShopCart(e) {
      // console.log(e)
      let {
        id
      } = e.currentTarget.dataset;
      this.$emit('onAdd', {
        detail: {
          id: id
        }
      }); // this.triggerEvent('onAdd', { id:id,disDiscountId: this.data.disDiscountId, disDiscount: this.data.disDiscount, disType: this.data.disType , disCondition: this.data.disCondition , disReduce: this.data.disReduce })
    }

  }
};
</script>
<style>
@import "./index.css";
</style>